import App from './App'
import store from './store'
import messages from './locale/index.js'
import { createSSRApp } from 'vue'
import { createI18n } from 'vue-i18n'
import vant,{ Locale } from 'vant'
import enUS from 'vant/es/locale/lang/en-US';
import zhCN from 'vant/es/locale/lang/zh-CN';


let i18nConfig = {
  locale:uni.getLocale(),
  messages
}
if(uni.getLocale()==='zh-Hans'){
	Locale.use('zh-CN', zhCN);
}else{
	Locale.use('en-US', enUS);
}

const i18n = createI18n(i18nConfig)

export function createApp() {
  const app = createSSRApp(App)
  app.use(i18n)
  app.use(vant)
  app.use(store)
  return {
    app
  }
}
